set(APP_NAME libcat)

# Set directory paths.
set(SFML_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../deps/SFML)
add_subdirectory(${SFML_PATH} ${CMAKE_CURRENT_BINARY_DIR}/../deps/sfml)
set_target_properties(sfml-main PROPERTIES FOLDER "${APP_NAME}/deps")
set_target_properties(sfml-audio PROPERTIES FOLDER "${APP_NAME}/deps")
set_target_properties(sfml-graphics PROPERTIES FOLDER "${APP_NAME}/deps")
set_target_properties(sfml-system PROPERTIES FOLDER "${APP_NAME}/deps")
set_target_properties(sfml-window PROPERTIES FOLDER "${APP_NAME}/deps")
set_target_properties(sfml-network PROPERTIES FOLDER "${APP_NAME}/deps")

set(SDL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../deps/SDL2-2.0.12)
add_subdirectory(${SDL_PATH} ${CMAKE_CURRENT_BINARY_DIR}/../deps/SDL2-2.0.12)
set_target_properties(SDL2 PROPERTIES FOLDER "${APP_NAME}/deps")

project(${APP_NAME})

set(${APP_NAME}_util_SOURCES
	${${APP_NAME}_util_PLATFORM_SOURCES}
	src/util/base.cpp
	src/util/cmem.cpp
	src/util/platform.cpp
	src/util/pipe-windows.cpp
)
set(${APP_NAME}_util_HEADERS
	${${APP_NAME}_util_PLATFORM_HEADERS}
	include/util/c99defs.hpp
	include/util/darray.hpp
	include/util/platform.hpp
	include/util/base.hpp
	include/util/cmem.hpp
	include/util/json.h
	include/util/json-forwards.h
	include/util/jsoncpp.cpp
	include/util/utf8.h
	include/util/pipe.hpp
)

set(${APP_NAME}_libcat_SOURCES
	${${APP_NAME}_libcat_PLATFORM_SOURCES}
	src/cat.cpp
	src/cat-data.cpp
	src/cat-module.cpp
	src/cat-proc.cpp
	src/cat-signal.cpp
	src/cat-source.cpp
	src/cat-window.cpp
	src/cat-hook.cpp
	src/cat-audio.cpp
)
set(${APP_NAME}_libcat_HEADERS
	${${APP_NAME}_libcat_PLATFORM_HEADERS}
	include/cat.hpp
	include/cat-data.hpp
	include/cat-def.hpp
	include/cat-interaction.hpp
	include/cat-internal.hpp
	include/cat-module.hpp
	include/cat-proc.hpp
	include/cat-signal.hpp
	include/cat-source.hpp
	include/cat-window.hpp
	include/cat-hook.hpp
	include/cat-audio.hpp
)
set(${APP_NAME}_SOURCES
	${${APP_NAME}_libcat_SOURCES}
	${${APP_NAME}_util_SOURCES}
)

set(${APP_NAME}_HEADERS
	${${APP_NAME}_libcat_HEADERS}
	${${APP_NAME}_util_HEADERS}
	include/header/cat-config.hpp
	)

add_library(${APP_NAME} SHARED
	${${APP_NAME}_SOURCES}
	${${APP_NAME}_HEADERS}
)
target_link_libraries(${APP_NAME}
	sfml-main
	sfml-audio
	sfml-graphics
	sfml-system
	sfml-window
	sfml-network
	SDL2
)

source_group("util\\Source Files" FILES ${${APP_NAME}_util_SOURCES})
source_group("util\\Header Files" FILES ${${APP_NAME}_util_HEADERS})
source_group("libcat\\Source Files" FILES ${${APP_NAME}_libcat_SOURCES})
source_group("libcat\\Header Files" FILES ${${APP_NAME}_libcat_HEADERS})

set_target_properties(${APP_NAME} PROPERTIES FOLDER "${APP_NAME}")